from flask import Blueprint, request
from ..controllers.repair import (
    create_repair,
    get_repairs,
    get_repair,
    update_repair,
    delete_repair
)

# 创建报修蓝图
repair_bp = Blueprint('repair', __name__)

@repair_bp.route('/repairs/add', methods=['POST'])
def route_create_repair():
    data = request.get_json() or {}
    return create_repair(data)

@repair_bp.route('/repairs/list', methods=['GET'])
def route_get_repairs():
    data = request.args.to_dict() or {}
    return get_repairs(data)

@repair_bp.route('/repairs/repair', methods=['GET'])
def route_get_repair():
    data = request.args.to_dict() or {}
    return get_repair(data)

@repair_bp.route('/repairs/edit', methods=['POST'])
def route_update_repair():
    return update_repair()

@repair_bp.route('/repairs/delete', methods=['POST'])
def route_delete_repair():
    return delete_repair()